using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MSRI.HelperClasses;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data;
using Instedd.Labs.Geo.Library.Kml;
using MSRI.SmsService;
using Instedd.Labs.Geo.Library.Sms;

namespace Instedd.Labs.Geo.Library.Tests.Managers
{
    /// <summary>
    /// Summary description for UnitTest1
    /// </summary>
    [TestClass]
    public class SmsManagerFixture
    {
        static SmsServiceClass defaultSmsService;

        public SmsManagerFixture()
        {}

        [ClassInitialize()]
        public static void ClassInitialize(TestContext testContext)
        {
            defaultSmsService = new SmsServiceClass("defaultServiceName");
        }


        [TestMethod]
        public void NotNullAndEmptySmsServiceNameCreatesAnInstanceOfSmsManager()
        {
            SmsManager manager = new SmsManager(defaultSmsService);

            Assert.IsNotNull(manager);
        }

        [TestMethod]
        public void NotNullAndEmptySmsServiceNameCreatesManagers()
        {
            SmsManager manager = new SmsManager(defaultSmsService);

            Assert.IsNotNull(manager.KmlManager);
            Assert.IsNotNull(manager.MessagesManager);
        }

        [TestMethod]
        public void NotNullAndEmptySmsServiceNameCreatesSmsService()
        {
            SmsManager manager = new SmsManager(defaultSmsService);

            Assert.IsNotNull(manager.Service);
            Assert.AreEqual(defaultSmsService, manager.Service);
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentNullException))]
        public void NullSmsServiceThrows()
        {
            SmsServiceClass smsService = null;
            SmsManager manager = new SmsManager(smsService);
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentNullException))]
        public void NullSmsServiceNameThrows()
        {
            string smsServiceName = null;
            SmsManager manager = new SmsManager(smsServiceName);
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void EmptySmsServiceNameThrows()
        {
            string smsServiceName = string.Empty;
            SmsManager manager = new SmsManager(smsServiceName);
        }
    }
}